<style>
    #systemRuleInfoForm .layui-form-label {
        width: 210px;
    }

    #systemRuleInfoForm .layui-input-block {
        margin-left: 245px;
    }

    .companyFormPhotos {
        /* margin-left:140px; */
        line-height: 38px;
        float: left;
        margin-right: 30px;
    }

    .companyFormPhotos img {
        cursor: pointer;
        height: 38px;
        width: auto;
        max-width: 200px;
    }

    .layui-fluid .layui-card .layui-card-body {
        padding: 0;
    }

    .sys_main {
        display: flex;
        flex-direction: column;
        padding: 8px 0;
        height: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }

    .sys_nav {
        height: 60px;
        box-sizing: border-box;
        border-bottom: 1px solid #EEEEEE;
        padding: 0 33px;
        position: relative;
        overflow: hidden;
    }

    .sys_nav_list {
        display: flex;
        height: 100%;
        align-items: center;
    }

    .sys_nav_item {
        padding: 16px 10px;
        margin-right: 50px;
        font-size: 20px;
        font-family: PingFang HK-Medium, PingFang HK;
        font-weight: 500;
        color: #333333;
        line-height: 23px;
        letter-spacing: 1px;
        cursor: pointer;
        transition: all 300ms;
    }

    .sys_nav_item:hover {
        color: #009C5E;
    }

    .sys_nav_item.active {
        color: #009C5E;
    }

    .sys_nav_bar {
        position: absolute;
        width: 130px;
        height: 4px;
        background: #009C5E;
        left: -1000px;
        bottom: 0;
        transition: all 300ms;
    }

    .sys_content {
        flex: 1;
        height: calc(100% - 60px);
        overflow: hidden;
    }

    .sys_content .sys_content_item {
        width: 100%;
        display: none;
        transition: all 300ms;
        box-sizing: border-box;
        height: 100%;
    }

    .sys_content_item.active {
        display: block;
    }

    .infomercial {
        padding: 0 33px;
        height: 100%;
        overflow: scroll;
    }

    .sys_display_nav {
        height: 104px;
        display: flex;
        border-bottom: 1px solid #EEEEEE;
        box-sizing: border-box;
        padding: 24px 33px 40px;
    }

    .sys_display_navItem {
        width: 176px;
        height: 40px;
        box-sizing: border-box;
        text-align: center;
        line-height: 38px;
        font-size: 16px;
        font-family: PingFang HK-Medium, PingFang HK;
        font-weight: 500;
        color: #009C5E;
        letter-spacing: 1px;
        border: 1px solid #009C5E;
        cursor: pointer;
        background-color: transparent;
        transition: all 1000ms;
    }

    .sys_display_navItem:not(:first-child) {
        border-left: none;
    }

    .sys_display_navItem.active,
    .sys_display_navItem:hover {
        background: #009C5E;
        color: #ffffff;
    }

    .sys_display_form {
        width: 100%;
        height: calc(100% - 110px);
    }

    .sys_display_box {
        height: calc(100% - 40px);
        overflow: scroll;
    }

    .sys_display_list {
        display: none;
    }

    .sys_display_list.active {
        display: block;
    }

    .sys_display_item {
        box-sizing: border-box;
        width: 100%;
        min-height: 61px;
        border-bottom: 1px solid #EEEEEE;
        padding: 10px 33px;
        display: flex;
        align-items: center;
        height: auto;
    }

    .sys_display_lable {
        flex: 2;
        font-size: 16px;
        font-family: PingFang HK-Medium, PingFang HK;
        font-weight: 500;
        color: #333333;
        letter-spacing: 1px;
    }

    .sys_display_operate {
        flex: 2;
        padding: 0 20px;
    }

    .sys_display_operate .layui-form-radio > i:hover,
    .sys_display_operate .layui-form-radioed > i {
        color: #0097DE;
    }

    .sys_display_remark {
        flex: 3;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="sys_main">
                <div class="sys_nav">
                    <div class="sys_nav_list" id="sysNavList">
                        <div class="sys_nav_item active">业务操作设置</div>
                        <div class="sys_nav_item">面板广告设置</div>
                        <div class="sys_nav_item">小程序广告设置</div>
                    </div>
                    <div class="sys_nav_bar" id="sysNavBar"></div>
                </div>
                <div class="sys_content" id="sysContent">
                    <div class="sys_content_item active">
                        <div class="sys_display_nav" id="sysDisplayNav">
                            <!--<div class="sys_display_navItem active">面板显示设置</div>-->
                            <div class="sys_display_navItem active">上货设置</div>
                            <div class="sys_display_navItem">领货设置</div>
                            <div class="sys_display_navItem">报修报废设置</div>
                            <div class="sys_display_navItem">暂存业务设置</div>
                            <div class="sys_display_navItem">其他设置</div>
                        </div>
                        <div class="layui-form sys_display_form" lay-filter="systemRuleInfoForm"
                             id="systemRuleInfoForm">
                            <div class="sys_display_box" id="sysDisplayBox">
                                <input id="id" name="id" type="hidden"/>
                                <!--面板显示设置-->
                                <!--<div class="sys_display_list">

                                </div>-->
                                <!--上货设置-->
                                <div class="sys_display_list active">
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">上货是否需要有物料库存</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="warehouseInventoryFlag" value="1" title="是"/>
                                            <input type="radio" name="warehouseInventoryFlag" value="0" title="否"
                                                   checked/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">缺料告警</div>
                                        <div class="sys_display_operate">
                                            <input name="defaultAlarmStock" placeholder="请输入缺料告警" type="text"
                                                   class="layui-input"/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">库存告警管理员</div>
                                        <div class="sys_display_operate">
                                            <input type="hidden" class="layui-input" name="inventoryManageUserId">
                                            <div id="inventoryManageUserId" class="xm-select-demo"></div>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                </div>
                                <!--领货设置-->
                                <div class="sys_display_list">
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">是否显示价格</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="showPriceFlag" value="1" title="显示" checked/>
                                            <input type="radio" name="showPriceFlag" value="0" title="不显示"/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">柜子默认领刀方式</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="devicePageFlag" value="1" title="按设备领" checked/>
                                            <input type="radio" name="devicePageFlag" value="0" title="按工单领"/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">是否隐藏工单列表</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="orderQueryFlag" value="1" title="隐藏"/>
                                            <input type="radio" name="orderQueryFlag" value="0" title="不隐藏" checked/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">工单方式</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="workOrderWay" value="mes" title="来自MES"/>
                                            <input type="radio" name="workOrderWay" value="manual" title="手动输入"
                                                   checked/>
                                            <input type="radio" name="workOrderWay" value="simple" title="简版管理"/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>


                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">领新同物料出货顺序</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="outOrderFlag" value="1" title="优先单个货道出完" checked/>
                                            <input type="radio" name="outOrderFlag" value="0" title="依次轮询货道出货"/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">是否限制每人每天领新总价</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="totalFlag" value="1" title="是"
                                                   lay-filter="totalFlag"/>
                                            <input type="radio" name="totalFlag" value="0" title="否"
                                                   lay-filter="totalFlag" checked/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                    <div class="sys_display_item" id="totalDiv">
                                        <div class="sys_display_lable">每人每天取刀总价限制</div>
                                        <div class="sys_display_operate">
                                            <input name="total" placeholder="请输入每人每天取刀总价限制" type="text"
                                                   class="layui-input"
                                                   lay-verify="" required/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">临时领新审核管理员</div>
                                        <div class="sys_display_operate">
                                            <input type="hidden" class="layui-input" name="mailManagementUserId">
                                            <div id="mailManagementUserId" class="xm-select-demo"></div>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">临时领新是否优先从售刀柜领新</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="outFirstCellCabFlag" value="1" title="是" checked/>
                                            <input type="radio" name="outFirstCellCabFlag" value="0" title="否"/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                </div>
                                <!--维修报废设置-->
                                <div class="sys_display_list">
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">不同的归还人分开存放</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="spaceUserShareFlag" value="0" title="分开"/>
                                            <input type="radio" name="spaceUserShareFlag" value="1" title="不分开" checked/>
                                        </div>
                                        <div class="sys_display_remark">备注：建议选择“是”,不同的人分开存放,方便溯源到责任人,请谨慎选择</div>
                                    </div>
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">不同的物料分开存放</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="spaceSkuShareFlag" value="0" title="分开"/>
                                            <input type="radio" name="spaceSkuShareFlag" value="1" title="不分开" checked/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">报修报废原因是否必填</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="recycleCauseRequired" value="1" title="是"/>
                                            <input type="radio" name="recycleCauseRequired" value="0" title="否"
                                                   checked/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                </div>
                                <!--暂存业务设置-->
                                <div class="sys_display_list">
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">不同的归还人分开存放</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="spaceTempUserShareFlag" value="0" title="分开"
                                                   checked/>
                                            <input type="radio" name="spaceTempUserShareFlag" value="1" title="不分开"/>
                                        </div>
                                        <div class="sys_display_remark">备注：建议选择“是”,不同的人分开存放,方便溯源到责任人,请谨慎选择</div>
                                    </div>
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">不同的物料分开存放</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="spaceTempSkuShareFlag" value="0" title="分开"
                                                   checked/>
                                            <input type="radio" name="spaceTempSkuShareFlag" value="1" title="不分开"/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">是否支持暂存多存（非专人）</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="spaceTempMoreFlag" value="1" title="支持多存"/>
                                            <input type="radio" name="spaceTempMoreFlag" value="0" title="不支持多存" checked/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>

                                </div>
                                <!--其他设置-->
                                <div class="sys_display_list">
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">还刀时间</div>
                                        <div class="sys_display_operate">
                                            <input name="changeTime" placeholder="请输入换刀时间默认值,单位:分钟" type="text"
                                                   class="layui-input" lay-verify="required" required/>
                                        </div>
                                        <div class="sys_display_remark">天</div>
                                    </div>
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">支持A借B还</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="abFlag" value="1" title="支持" checked/>
                                            <input type="radio" name="abFlag" value="0" title="不支持"/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>
                                    <div class="sys_display_item">
                                        <div class="sys_display_lable">是否管理刀具寿命周期</div>
                                        <div class="sys_display_operate">
                                            <input type="radio" name="lifeFlag" value="1" title="是"/>
                                            <input type="radio" name="lifeFlag" value="0" title="否" checked/>
                                        </div>
                                        <div class="sys_display_remark"></div>
                                    </div>

                                </div>
                            </div>
                            <div class="layui-form-item text-right" style="margin-right: 80px">
                                <button class="layui-btn" lay-filter="systemRuleInfoFormSubmit" lay-submit>保存</button>
                            </div>
                        </div>
                    </div>
                    <div class="sys_content_item  infomercial">
                        <div class="infomercial_box">

                            <div class="layui-inline" style="margin-top: 10px;">
                                <button id="advertisingBtnAdd" class="layui-btn icon-btn"><i
                                        class="layui-icon">&#xe654;</i>添加
                                </button>
                            </div>
                            <div class="layui-inline" style="margin-top: 10px; ">
                                <label class="layui-form-label">视频</label>
                                <div class="layui-input-inline">
                                    <input name="advertVideo" id="advertVideo" type="text" class="layui-input"
                                           style="width: 820px" readonly/>
                                </div>
                                <div id="deviceVideoBtn" class="layui-btn"><i class="layui-icon">&#xe681;</i>上传视频</div>
                            </div>

                            <table class="layui-table" id="sysSettingTable" lay-filter="sysSettingTable"></table>
                        </div>
                    </div>
                    <div class="sys_content_item">
                        <div class="infomercial_box">
                            <table class="layui-table" id="appletTable" lay-filter="appletTable"></table>
                        </div>
                    </div>
                </div>
            </div>
            <!--<form lay-filter="systemRuleInfoForm" class="layui-form model-form" id="systemRuleInfoForm">
                <input id="id" name="id" type="hidden"/>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否显示价格</label>
                    <div class="layui-input-block">
                        <input type="radio" name="showPriceFlag" value="1" title="是" checked/>
                        <input type="radio" name="showPriceFlag" value="0" title="否"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否限制每人每天取刀总价</label>
                    <div class="layui-input-block">
                        <input type="radio" name="totalFlag" value="1" title="是" lay-filter="totalFlag"/>
                        <input type="radio" name="totalFlag" value="0" title="否" lay-filter="totalFlag" checked/>
                    </div>
                </div>
                <div class="layui-form-item" id="totalDiv">
                    <label class="layui-form-label">每人每天取刀总价限制</label>
                    <div class="layui-input-block">
                        <input name="total" placeholder="请输入每人每天取刀总价限制" type="text" class="layui-input"
                               lay-verify="" required/>
                    </div>
                </div>

                 <div class="layui-form-item">
                    &lt;!&ndash;是否支持多人共存&ndash;&gt;
                    <label class="layui-form-label">不同的归还人分开存放<br>(报修&报废)</label>
                    <div class="layui-input-block">
                        <input type="radio" name="spaceUserShareFlag" value="0" title="是"/>
                        <input type="radio" name="spaceUserShareFlag" value="1" title="否" checked/>

                        （建议选择“是”：不同的人分开存放，方便溯源到责任人，请谨慎选择）
                    </div>
                </div>
                <div class="layui-form-item">
                    &lt;!&ndash;是否支持物料共存&ndash;&gt;
                    <label class="layui-form-label">不同的物料分开存放<br>(报修&报废)</label>
                    <div class="layui-input-block">
                        <input type="radio" name="spaceSkuShareFlag" value="0" title="是"/>
                        <input type="radio" name="spaceSkuShareFlag" value="1" title="否" checked/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">不同的归还人分开存放<br>(暂存)</label>
                    <div class="layui-input-block">
                        <input type="radio" name="spaceTempUserShareFlag" value="0" title="是"checked/>
                        <input type="radio" name="spaceTempUserShareFlag" value="1" title="否" />
                        （建议选择“是”：不同的人分开存放，方便溯源到责任人，请谨慎选择）
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">不同的物料分开存放<br>(暂存)</label>
                    <div class="layui-input-block">
                        <input type="radio" name="spaceTempSkuShareFlag" value="0" title="是" checked/>
                        <input type="radio" name="spaceTempSkuShareFlag" value="1" title="否" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否支持暂存多存(非专人)</label>
                    <div class="layui-input-block">
                        <input type="radio" name="spaceTempMoreFlag" value="1" title="是" />
                        <input type="radio" name="spaceTempMoreFlag" value="0" title="否" checked/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">支持A借B还</label>
                    <div class="layui-input-block">
                        <input type="radio" name="abFlag" value="1" title="是" checked/>
                        <input type="radio" name="abFlag" value="0" title="否"/>
                    </div>
                </div>
                 <div class="layui-form-item">
                    <label class="layui-form-label">柜子面板是否优先显示按设备存刀</label>
                    <div class="layui-input-block">
                        <input type="radio" name="devicePageFlag" value="1" title="是" checked/>
                        <input type="radio" name="devicePageFlag" value="0" title="否"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否管理刀具寿命周期</label>
                    <div class="layui-input-block">
                        <input type="radio" name="lifeFlag" value="1" title="是" />
                        <input type="radio" name="lifeFlag" value="0" title="否" checked/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">上货是否需要有物料库存</label>
                    <div class="layui-input-block">
                        <input type="radio" name="warehouseInventoryFlag" value="1" title="是" />
                        <input type="radio" name="warehouseInventoryFlag" value="0" title="否" checked/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">领新同物料出货顺序</label>
                    <div class="layui-input-block">
                        <input type="radio" name="outOrderFlag" value="1" title="优先单个货道出完" checked/>
                        <input type="radio" name="outOrderFlag" value="0" title="依次轮询货道出货" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">报废原因是否必填</label>
                    <div class="layui-input-block">
                        <input type="radio" name="recycleCauseRequired" value="1" title="是" />
                        <input type="radio" name="recycleCauseRequired" value="0" title="否" checked/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">密码领货是否优先从售刀柜领新</label>
                    <div class="layui-input-block">
                        <input type="radio" name="outFirstCellCabFlag" value="1" title="是" checked/>
                        <input type="radio" name="outFirstCellCabFlag" value="0" title="否" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label ">工单方式</label>
                    <div class="layui-input-block">
                        <input type="radio" name="workOrderWay" value="mes" title="来自MES" checked/>
                        <input type="radio" name="workOrderWay" value="manual" title="手动输入" />
                        <input type="radio" name="workOrderWay" value="simple" title="简版管理"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">物料告警默认值</label>
                    <div class="layui-input-block">
                        <input name="defaultAlarmStock" placeholder="请输入物料告警默认值" type="text" class="layui-input" lay-verify="required" required/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">库存告警管理员</label>
                    <div class="layui-input-inline" style="width: 500px">
                        <input type="hidden" class="layui-input" name="inventoryManageUserId">
                        <div id="inventoryManageUserId" class="xm-select-demo"></div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">领新审核管理员</label>
                    <div class="layui-input-inline" style="width: 500px">
                        <input type="hidden" class="layui-input" name="mailManagementUserId">
                        <div id="mailManagementUserId" class="xm-select-demo"></div>
                    </div>
                </div>
                 <div class="layui-form-item">
                    <label class="layui-form-label">还刀时间</label>
                    <div class="layui-input-block">
                        <input name="changeTime" placeholder="请输入换刀时间默认值,单位:分钟" type="text" class="layui-input" lay-verify="required" required/>
                    </div>
                </div>
                <div class="layui-form-item text-right">
                    <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
                    <button class="layui-btn" lay-filter="systemRuleInfoFormSubmit" lay-submit>保存</button>
                </div>
            </form>-->
        </div>
    </div>
</div>

<!--列表按钮-->
<script type="text/html" id="isDeletedTable">
    <input type="checkbox" lay-filter="ckState" lay-skin="switch" lay-text="开启|停用"
           value="{{d.id}}" {{d.isDeleted==0?'checked':''}}/>
</script>
<script type="text/html" id="sysSettingTableBar">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>

<script type="text/html" id="appletTableBar">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">编辑</a>
</script>


<!-- 添加页面-->
<!--<script type="text/html" id="addSettingForm">
    <div class="addPurchaseOrder">
        <form lay-filter="addSettingForm" class="layui-form model-form">
            <input name="id" type="hidden">


            <div class="layui-form-item">
                <a class="layui-btn icon-btn" lay-filter="addAdvertBtn" id="addAdvertBtn" lay-submit style="margin-left: 20px;">添加广告</a>
            </div>

            &lt;!&ndash; 表格 &ndash;&gt;
            <div class="layui-form-item" id="addTasksBox" style="margin-left: 20px;">
                <table class="layui-table" id="settingAdvertTable" lay-filter="settingAdvertTable"></table>
            </div>

            <div class="layui-form-item text-right">
                <a class="layui-btn" lay-filter="addSettingSubmit" id="addSettingSubmit" lay-submit>提交</a>
                <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
            </div>
        </form>
    </div>
</script>-->

<script type="text/html" id="sysSettingDetailForm">
    <form lay-filter="sysSettingDetailForm" class="layui-form model-form">
        <input name="id" type="hidden"/>
        <div class="layui-form-item">
            <label class="layui-form-label">广告图名称</label>
            <div class="layui-input-inline">
                <input name="name" id="name" placeholder="" type="text" class="layui-input" lay-verify="required"
                       required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">广告图片</label>
            <div class="layui-input-block">
                <div id="headerImg" class="companyFormPhotos"></div>
                <div id="devicePicBtn" class="layui-btn" style="float: left;"><i class="layui-icon">&#xe681;</i>上传图片
                </div>
                <input name="advertUrl" id="advertUrl" type="hidden" class="layui-input" lay-verify=""/>

            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">链接地址</label>
            <div class="layui-input-inline">
                <input name="advertLink" id="advertLink" type="text" class="layui-input" lay-verify="required"
                       required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否启用</label>
            <div class="layui-input-block">
                <input name="isDeleted" type="checkbox" id="isDeleted" lay-skin="switch" value="1" checked="false"
                       lay-text="启用|停用"/>
            </div>
            <!--<div class="layui-input-inline">
                <select name="isDeleted" id="isDeleted" lay-verify="required">
                    <option value="0">显示</option>
                    <option value="1">不显示</option>
                </select>
            </div>-->
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline">
                <input name="remark" id="remark" placeholder="" type="text" class="layui-input" lay-verify="required"
                       required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-inline">
                <input name="sortNumber" id="sortNumber" placeholder="" type="text" class="layui-input"
                       lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="settingFormDetailSubmit">提交</button>
            </div>
        </div>
    </form>
</script>

<!-- 表单弹窗 -->
<!--<script type="text/html" id="sysSettingForm">
    <form lay-filter="settingForm" class="layui-form model-form">
        <input name="id" type="hidden"/>
        <div class="layui-form-item">
            <label class="layui-form-label">广告图名称</label>
            <div class="layui-input-inline">
                <input name="name" id="name" placeholder="" type="text" class="layui-input" lay-verify="required"
                       required/>
            </div>
        </div>

        &lt;!&ndash;        <div class="layui-form-item">
                    <label class="layui-form-label">广告图片</label>
                    <div class="layui-input-block">
                        <div id="devicePic_path" class="companyFormPhotos"></div>
                        <div id="devicePicBtn" class="layui-btn" style="float: left;"><i class="layui-icon">&#xe681;</i>上传图片
                        </div>
                        <input name="advertUrl" type="hidden" class="layui-input" lay-verify="" id="advertUrl"/>
                    </div>
                </div>&ndash;&gt;

        <div class="layui-form-item">
            <label class="layui-form-label">广告图片</label>
            <div class="layui-input-block">
                <div id="headerImg" class="companyFormPhotos"></div>
                <div id="devicePicBtn" class="layui-btn" style="float: left;"><i class="layui-icon">&#xe681;</i>上传图片
                </div>
                <input name="advertUrl" id="advertUrl" type="hidden" class="layui-input" lay-verify=""/>

            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">链接地址</label>
            <div class="layui-input-inline">
                <input name="advertLink" id="advertLink" type="text" class="layui-input" lay-verify="required"
                       required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否启用</label>
            <div class="layui-input-block">
                <input name="isDeleted" type="checkbox" id="isDeleted" lay-skin="switch" value="1" checked="false" lay-text="启用|停用"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline">
                <input name="remark" id="remark" placeholder="" type="text" class="layui-input" lay-verify="required"
                       required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-inline">
                <input name="sortNumber" id="sortNumber" placeholder="" type="text" class="layui-input"
                       lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="SettingFormSubmit">提交</button>
            </div>
        </div>
    </form>



</script>-->

<!--小程序编辑弹窗-->
<script type="text/html" id="appletForm">
    <form lay-filter="appletForm" class="layui-form model-form">
        <input name="id" type="hidden"/>
        <div class="layui-form-item">
            <label class="layui-form-label">广告图名称</label>
            <div class="layui-input-inline">
                <input name="name" placeholder="" type="text" class="layui-input" lay-verify="required" required/>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">广告图片</label>
            <div class="layui-input-block">
                <div id="advertUrlImg" class="companyFormPhotos"></div>
                <div id="advertUrlBtn" class="layui-btn" style="float: left;"><i class="layui-icon">&#xe681;</i>上传图片
                </div>
                <input name="advertUrl" type="hidden" class="layui-input" lay-verify=""/>

            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">链接地址</label>
            <div class="layui-input-inline">
                <input name="advertLink" type="text" class="layui-input" lay-verify="required"
                       required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否启用</label>
            <div class="layui-input-block">
                <input name="isDeleted" type="checkbox" lay-skin="switch" value="1" checked="false" lay-text="启用|停用"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline">
                <input name="remark" placeholder="" type="text" class="layui-input" lay-verify="required"
                       required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-inline">
                <input name="sortNumber" placeholder="" type="text" class="layui-input"
                       lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="SettingFormSubmit">提交</button>
            </div>
        </div>
    </form>

</script>

<!-- js部分 -->
<script>
    layui.use(['layer', 'form', 'table', 'admin', 'upload'], function () {
        var $ = layui.jquery;
        // var layer = layui.layer;
        // var form = layui.form;
        // var admin = layui.admin;
        let {layer, form, admin, config, table, upload} = layui;

        let sysNavItemEle = $('#sysNavList .sys_nav_item.active');
        $('#sysNavBar').css({left: (sysNavItemEle.position().left + 10) + "px"});
        $('#sysNavBar').css({width: sysNavItemEle.width() + "px"});

        /*面板（广告/显示）设置导航 切换功能*/
        $('#sysNavList .sys_nav_item').click(function () {
            $(this).addClass('active').siblings().removeClass('active');
            $('#sysNavBar').css({left: ($(this).position().left + 10) + "px"});
            $('#sysNavBar').css({width: $(this).width() + "px"});
            $('#sysContent > .sys_content_item').eq($(this).index()).show(300).siblings().hide();
        });

        /*面板显示设置子导航切换功能*/
        $('#sysDisplayNav .sys_display_navItem').click(function () {
            $(this).addClass('active').siblings().removeClass('active');
            $('#sysDisplayBox>.sys_display_list').eq($(this).index()).show(300).siblings().hide();
        });

        let insTb = table.render({
            elem: '#sysSettingTable',
            // url: config.base + 'enterprisecab/setting/admin/sysSettingAdvert/list',
            url: config.base + 'enterprisecab/setting/admin/sysSettingAdvert/getAdvertInfoBySetting?type=2',
            cellMinWidth: 100,
            cols: [[
                {field: 'id', title: 'ID', width: 100}
                , {field: 'name', title: '广告名称', width: 200}
                , {
                    field: 'advertUrl',
                    title: '广告图片',
                    templet: d => '<img class="checkImg" src="' + d.advertUrl + '">',
                    width: 100
                }
                , {field: 'advertLink', title: '广告链接', width: 200}
                , {field: 'isDeleted', templet: '#isDeletedTable', title: '是否启用', unresize: true, width: 100}
                , {field: 'remark', title: '备注', width: 200}
                , {field: 'createTime', sort: true, title: '添加时间', width: 200}
                , {align: 'center', toolbar: '#sysSettingTableBar', title: '操作', width: 200}
            ]],
            parseData: function (res) {
                /*return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "data": res.data.advert //解析数据列表
                };*/
            }
        });
        // insTb.resize()
        // 修改状态
        form.on('switch(ckState)', function (obj) {
            layer.load(2);
            admin.req('enterprisecab/setting/admin/sysSetting/upIsDelete', {
                id: obj.elem.value,
                isDeleted: obj.elem.checked ? 0 : 1
            }, function (data) {
                layer.closeAll('loading');
                if (data.code == 200) {
                    layer.msg(data.msg, {icon: 1});
                    table.reload('appletTable');
                } else {
                    layer.msg(data.msg, {icon: 2});
                    $(obj.elem).prop('checked', !obj.elem.checked);
                    form.render('checkbox');
                }
            }, 'PUT');
        });

        admin.req('enterprisecab/cabinet/admin/sysSetting/getOneByParams', {
            enterpriseCode: config.getUser().enterpriseCode,
            type: "startCab"
        }, function (res) {
            if (res.code == 200) {
                $("input[name='advertVideo']").val(res.data.advertVideo);
            }
        });
        //上传视频
        $('#deviceVideoBtn').click(uploadVideo('deviceVideoBtn', 'advertVideo'));
        // 添加按钮点击事件
        $('#advertisingBtnAdd').click(function () {
            showAddAdvertModel();
        });
        var addAdvertList = []; // 添加的详情数据
        // 添加
        /*function showAddModel(data){
            admin.open({
                type: 1,
                area: ['1200px','600px'],
                offset: '85px',
                title: data?'修改':'添加',
                content: $('#addSettingForm').html(),
                success: function () {
                    if(data){
                        $("#addAdvertBtn").hide();
                        admin.req('enterprisecab/setting/admin/sysSetting/getSettingListByParam', {advertId: data.id}, function (res) {
                            if (res.code == 200){
                                addAdvertList = res.data;
                                table.reload('settingAdvertTable', {data:addAdvertList});
                            }
                        }, 'GET')
                    }
                    // 添加详情按钮点击事件
                    $('#addAdvertBtn').click(function () {
                        showAddAdvertModel();
                    })

                    //上传视频
                    $('#deviceVideoBtn').click(uploadVideo('deviceVideoBtn', 'advertVideo'))

                    console.log(addAdvertList)
                    var insTb = table.render({
                        elem: '#settingAdvertTable',
                        cellMinWidth: 100,
                        data: addAdvertList,
                        cols: [[
                            {type: 'numbers', title: 'ID'}
                            , {field: 'name', sort: true, title: '广告名称'}
                            , {field: 'advertUrl', sort: true, title: '广告图片',templet: '#advertPicture'}
                            , {field: 'advertLink', sort: true, title: '广告链接'}
                            ,{field: 'isDeleted', templet: '#isDeletedTable', title: '是否启用', unresize: true}
                            , {field: 'remark', sort: true, title: '备注'}
                            // , {field: 'sortNumber', sort: true, title: '排序'}
                            , {align: 'center', toolbar: '#settingAdvertTableBar', title: '操作', width: 200}
                        ]],
                    });

                    form.val('addSettingForm', data);
                    $("input[name='id']").val(data.settingId);
                    form.on('submit(addSettingSubmit)', function (d) {
                        if (data){ //修改

                            console.log(d.field)
                            admin.req( 'enterprisecab/cabinet/admin/sysSetting/update', d.field, function (res) {

                                layer.closeAll('loading');
                                if (res.code == 200) {
                                    layer.msg(res.msg, {icon: 1});
                                    table.reload('sysSettingTable');
                                    layer.closeAll('page');

                                    table.reload('sysSettingTable');
                                } else {
                                    layer.msg(res.msg, {icon: 2});
                                }
                            },'PUT')
                        } else { //添加
                            d.field.advert = addAdvertList;
                            for (let i = 0; i <d.field.advert.length ; i++) {
                                if (d.field.advert[i].isDeleted==0){
                                    d.field.advert[i].isDeleted = false
                                }else {
                                    d.field.advert[i].isDeleted = true
                                }
                            }

                            console.log(d.field)
                            admin.req('enterprisecab/cabinet/admin/startSetting/addSettingList', JSON.stringify(d.field), function (res) {

                                layer.closeAll('loading');
                                if (res.code == 200) {
                                    layer.msg(res.msg, {icon: 1});
                                    table.reload('sysSettingTable');
                                    layer.closeAll('page');

                                    table.reload('sysSettingTable');
                                } else {
                                    layer.msg(res.msg, {icon: 2});
                                }
                            },'POST',true, 'application/json;charset=utf-8')

                        }

                        return false;
                    })

                }
            })
        }*/

        // 添加详情数据
        function showAddAdvertModel(data) {
            let addDetail = admin.open({
                type: 1,
                area: ['1180px', '800px'],
                offset: '65px',
                title: data ? '广告修改' : '广告添加',
                content: $('#sysSettingDetailForm').html(),
                success: function () {
                    if (data) {

                        admin.req('enterprisecab/cabinet/admin/sysSetting/getSettingById', {id: data.id}, function (res) {
                            if (res.code == 200) {
                                form.val('sysSettingDetailForm', res.data);
                                $('#headerImg').html('<img src="' + res.data.advertUrl + '" style="height: 35px;" />');

                                if (res.data.isDeleted) {
                                    $("form input[name='isDeleted']").prop("checked", "");
                                } else {
                                    $('form input[name=isDeleted]').prop("checked", "checked");
                                }
                            }

                        }, 'GET', false)
                    }
                    form.render('checkbox');
                    //上传头像
                    $('#devicePicBtn').click(uploadImg('devicePicBtn', 'headerImg', 'advertUrl'))
                    form.on('submit(settingFormDetailSubmit)', function (d) {
                        d.field.isDeleted ? d.field.isDeleted = 0 : d.field.isDeleted = 1;
                        if (data) { //修改
                            admin.req('enterprisecab/cabinet/admin/sysSetting/upDate', JSON.stringify(d.field), function (res) {
                                layer.closeAll('loading');
                                if (res.code == 200) {
                                    layer.msg(res.msg, {icon: 1});
                                    table.reload('sysSettingTable');
                                    layer.closeAll('page');
                                    // 渲染表格
                                    table.reload('sysSettingTable');
                                } else {
                                    layer.msg(res.msg, {icon: 2});
                                }
                            }, 'POST', true, 'application/json; charset=utf-8');
                            return false;
                        } else { //添加
                            d.field.type = 2;
                            admin.req('enterprisecab/setting/admin/sysSettingAdvert/add', d.field, function (res) {
                                layer.closeAll('loading');
                                if (res.code == 200) {
                                    layer.msg(res.msg, {icon: 1});
                                    table.reload('sysSettingTable');
                                    layer.closeAll('page');
                                    // 渲染表格
                                    table.reload('sysSettingTable');
                                } else {
                                    layer.msg(res.msg, {icon: 2});
                                }
                            }, 'POST');
                            return false;

                        }

                    });
                    form.render("select");
                }
            })
        }


        // 显示编辑弹窗
        /*function showEditModel(data) {
            admin.open({
                type: 1,
                area: ['1180px', '800px'],
                offset: '65px',
                title: '详情',
                content: $('#sysSettingForm').html(),
                success: function () {
                    form.val('sysSettingForm', data);
                    admin.req('enterprisecab/setting/admin/sysSetting/getSettingById', {id: data.id}, function (res) {
                        console.log(res.data)
                        $('#name').val(data.name);
                        $('#headerImg').html('<img src="' + res.data.advertUrl + '" style="height: 35px;" class="checkImg"/>');
                        $('#advertLink').val(res.data.advertLink);
                        $('#remark').val(res.data.remark);
                        $('#sortNumber').val(res.data.sortNumber);

                        if (res.data.isDeleted){
                            $("form input[name='isDeleted']").prop("checked","");
                        }else {
                            $('form input[name=isDeleted]').prop("checked", "checked");
                        }

                    }, 'GET', false);

                    form.render('checkbox');

                    form.on('submit(SettingFormSubmit)', function (d) {
                        form.val('sysSettingForm', data);

                        d.field.id = data.id;
                        var b =document.getElementById("headerImg").getElementsByTagName("img");
                        d.field.advertUrl = b[0].currentSrc;
                        // 表单提交事件
                        d.field.isDeleted?d.field.isDeleted=0:d.field.isDeleted=1;


                        admin.req('enterprisecab/setting/admin/sysSetting/upDate',JSON.stringify(d.field), function (res) {
                            layer.closeAll('loading');
                            if (res.code == 200) {
                                layer.msg(res.msg, {icon: 1});
                                layer.closeAll('page');
                                table.reload('sysSettingTable')
                            } else {
                                layer.msg(res.msg, {icon: 2});
                            }
                        }, 'POST', true, 'application/json; charset=utf-8');
                        return false;
                    });

                    //上传头像
                    $('#devicePicBtn').click(uploadImg('devicePicBtn', 'headerImg', 'advertUrl'))
                }
            });
        }*/

        // 上传图片
        function uploadImg(_elem, pathId, inputId) {
            upload.render({
                elem: '#' + _elem
                , url: config.upload_url + 'uploadFile'
                , data: {}
                , accept: 'file'
                , exts: 'jpg|png|RAR|zip|pdf|txt|doc|docx|xls|xlsx|ppt|pptx'
                , headers: {Authorization: 'Bearer ' + config.getToken()}
                , done: function (res) {
                    if (res.code == 200) {
                        layer.msg(res.msg || "上传成功", {icon: 1});
                        let imagUrl = res.data.url;
                        $('#' + pathId).html('<img src="' + imagUrl + '"/>');
                        $('#' + inputId).val(imagUrl);
                    } else if (res.code == 502) {
                        return location.replace('admin/login.html');
                    } else {
                        layer.msg(res.msg || "上传失败", {icon: 2});
                    }
                }
            });
        }

        //上传视频
        function uploadVideo(_elem, inputId) {
            upload.render({
                elem: '#' + _elem
                , url: config.upload_url + 'uploadFile' // 上传接口
                , accept: 'file'
                , exts: 'mp4|m4v|wmv|flv'
                , headers: {Authorization: 'Bearer ' + config.getToken()}
                , done: function (res) {
                    if (res.code === 200) {
                        admin.req('enterprisecab/setting/admin/sysSetting/add', {
                            advertVideo: res.data.url,
                            type: 'startCab'
                        }, function (res2) {
                            layer.closeAll('loading');
                            if (res2.code == 200) {
                                // 上传成功
                                layer.msg("上传成功", {icon: 1});

                                //input赋值
                                $('#' + inputId).val(res.data.url);
                            } else {
                                layer.msg("上传失败", {icon: 2});
                            }
                        }, 'POST');

                    } else if (res.code == 502) {
                        return location.replace('admin/login.html');
                    } else {
                        layer.msg(res.msg || "上传失败", {icon: 2});
                    }
                }
                , error: function () {
                    layer.msg('请求异常');
                }
            });
        }

        // 工具条点击事件
        table.on('tool(sysSettingTable)', function (obj) {
            var data = obj.data;
            if (obj.event === 'edit') { //修改
                console.log(data);
                showAddAdvertModel(data);

            } else if (obj.event === 'del') { // 删除
                doDelete(obj);
            }
        });


        //监听排序
        table.on('sort(sysSettingTable)', function (obj) {
            table.reload('sysSettingTable', {
                initSort: obj
                , where: {
                    sort: obj.field
                    , order: obj.type
                }
            });
        });

        // 删除
        function doDelete(obj) {
            layer.confirm('确定要删除吗？', {
                offset: '65px',
                skin: 'layui-layer-admin'
            }, function (i) {
                layer.close(i);
                layer.load(2);
                admin.req('enterprisecab/setting/admin/sysSettingAdvert/' + obj.data.id, {}, function (res) {
                    layer.closeAll('loading');
                    if (res.code == 200) {
                        layer.msg(res.msg, {icon: 1});
                        obj.del();
                    } else {
                        layer.msg(res.msg, {icon: 2});
                    }
                }, 'DELETE');
            });
        }

        list();

        //初始化表单
        function list() {
            admin.req('enterprise/system/admin/systemRuleInfo/list', {}, function (res) {
                getAllAdmin(res.data[0].inventoryManageUserId, '#inventoryManageUserId', 'inventoryManageUserId');
                getAllAdmin(res.data[0].mailManagementUserId, '#mailManagementUserId', 'mailManagementUserId');
                form.val("systemRuleInfoForm", res.data[0]);
                if (res.data[0].totalFlag) {
                    $("#totalDiv").show();
                } else {
                    $("#totalDiv").hide();
                }
                form.render();
            }, 'GET');

        }

        function getAllAdmin(_initValue, _elem, _inputName) {
            admin.req('user/admin/user/getAll', {}, function (res) {
                if (res.code == 200) {
                    xmSelect.render({
                        el: _elem,
                        filterable: true,
                        initValue: _initValue.split(','),
                        autoRow: true,
                        paging: true,
                        pageSize: 5,
                        data: () => {
                            res.data.forEach((item, index) => {
                                item.name = item.nickname;
                                item.value = item.id
                            });
                            return res.data;
                        },
                        on: data => {
                            let inventoryManageUserIdValues = [];
                            data.arr.forEach(item => {
                                inventoryManageUserIdValues.push(item.id)
                            });
                            $('input[name="' + _inputName + '"]').val(inventoryManageUserIdValues.toString())
                        }
                    });

                } else {
                    layer.msg(res.msg, {icon: 2});
                }
            }, 'GET');
        }

        form.on('radio(totalFlag)', function (data) {
            if (data.value == 0) {
                $("#totalDiv").hide({duration: '300'});
            } else {
                $("#totalDiv").show({duration: '300'});
            }
        });

        // 表单提交事件
        form.on('submit(systemRuleInfoFormSubmit)', function (d) {
            if ($("#id").val() != "") {
                admin.req('enterprise/system/admin/systemRuleInfo/update', d.field, function (res) {
                    layer.closeAll('loading');
                    if (res.code == 200) {
                        layer.msg(res.msg, {icon: 1});
                    } else {
                        layer.msg(res.msg, {icon: 2});
                    }
                    list();
                }, 'PUT');
            } else {
                admin.req('enterprise/system/admin/systemRuleInfo/add', d.field, function (res) {
                    layer.closeAll('loading');
                    if (res.code == 200) {
                        layer.msg(res.msg, {icon: 1});
                    } else {
                        layer.msg(res.msg, {icon: 2});
                    }
                    list();
                }, 'POST');
            }
            return false;
        });

        $("body").delegate(".checkImg", "click", function () {
            admin.previewImg(this)
        });

        // 小程序table
        let appletTb = table.render({
            elem: '#appletTable',
            // url: config.base + 'enterprisecab/setting/admin/sysSetting/getSettingCabInfo',
            url: config.base + 'enterprisecab/setting/admin/sysSettingAdvert/getAdvertInfoBySetting?type=1',
            cellMinWidth: 100,
            cols: [[
                {field: 'id', title: 'ID', width: 100}
                , {field: 'name', title: '广告名称', width: 200}
                , {
                    field: 'advertUrl',
                    title: '广告图片',
                    templet: d => '<img class="checkImg" src="' + d.advertUrl + '">',
                    width: 100
                }
                , {field: 'advertLink', title: '广告链接', width: 200}
                , {field: 'isDeleted', templet: '#isDeletedTable', title: '是否启用', unresize: true, width: 100}
                , {field: 'remark', title: '备注', width: 200}
                , {field: 'createTime', sort: true, title: '添加时间', width: 200}
                , {field: 'sortNumber', sort: true, title: '排序', width: 100}
                , {align: 'center', toolbar: '#appletTableBar', title: '操作', width: 200}
            ]],
            parseData: function (res) {
              /*  return {
                    // "code": res.code, //解析接口状态
                    // "msg": res.msg, //解析提示文本
                    // "data": res.data.advert //解析数据列表
                };*/
            }
        });

        // 小程序工具条点击事件
        table.on('tool(appletTable)', function (obj) {
            var data = obj.data;
            if (obj.event === 'edit') { //修改
                showEditModel(data);

            } else if (obj.event === 'del') { // 删除
                doDelete(obj);
            }
        });

        // 小程序显示编辑弹窗
        function showEditModel(data) {
            admin.open({
                type: 1,
                area: ['1180px', '800px'],
                offset: '65px',
                title: '详情',
                content: $('#appletForm').html(),
                success: function () {
                    form.val('appletForm', data);
                    $('#advertUrlImg').html('<img src="' + data.advertUrl + '"/>');
                    if (data.isDeleted) {
                        $("form input[name='isDeleted']").prop("checked", "");
                    } else {
                        $('form input[name=isDeleted]').prop("checked", "checked");
                    }
                    form.render('checkbox');
                    form.on('submit(SettingFormSubmit)', function (d) {
                        d.field.isDeleted ? d.field.isDeleted = 0 : d.field.isDeleted = 1;
                        admin.req('enterprisecab/setting/admin/sysSetting/upDate', JSON.stringify(d.field), function (res) {
                            layer.closeAll('loading');
                            if (res.code == 200) {
                                layer.msg(res.msg, {icon: 1});
                                layer.closeAll('page');
                                table.reload('appletTable');
                            } else {
                                layer.msg(res.msg, {icon: 2});
                            }
                        }, 'POST', true, 'application/json; charset=utf-8');
                        return false;
                    });

                    //上传头像
                    $('#advertUrlBtn').click(uploadImg('advertUrlBtn', 'advertUrlImg', 'advertUrl'))
                }
            });
        }


    });
</script>